﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace UI.Forms
{
    public partial class 号码选择 : FormBase1
    {
        public delegate void DoAction(string phone,string cno);//如果有参数的话，定义参数 
        public DoAction FatherRefresh;
        private int? comboid = null;
        private decimal? yue = null;
        DateTime? activedate=null;
        bool? monthflag = null;
        private string no = "";
        List<phone_state> psl = null;
        public 号码选择(int _comboID,bool _monthflag,decimal _yue,DateTime _activedate,string _no)
        {
            InitializeComponent();
            comboid = _comboID;
            yue = _yue;
            activedate = _activedate;
            monthflag = _monthflag;
            no = _no;
        }

        private void 号码选择_Load(object sender, EventArgs e)
        {

            rlue_state.DataSource = my.phone_state_List;
            rlue_state.DisplayMember = "memo";
            rlue_state.ValueMember = "id";
            if (monthflag.Value)
            {
                gridControl1.DataSource = my.bw.cansalenumber_Get(comboid.Value, activedate.Value, yue.Value, my.ACID);
            }
            else
            {
                gridControl1.DataSource = my.bw.cansalenumberNotMonth_Get(comboid.Value, yue.Value, my.ACID);
            }
            gridView1.BestFitColumns();
        }

        private void btn_OK_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0) return;
            if (monthflag.Value)
            {
                FatherRefresh((gridView1.GetRow(gridView1.FocusedRowHandle) as SVC.client.GetnumberMonth_CanSaleResult).phone, no);
            }
            else
            {
                FatherRefresh((gridView1.GetRow(gridView1.FocusedRowHandle) as SVC.client.GetnumberNotMonth_CanSaleResult).phone, no);
            }
            this.Close();
        }


    }

}